import request from "@/request";

// 参数接口
export interface Save_5Params {
    id: number;
    label: string;
    icon: string;
    route: string;
    component: string;
    state: number;
}

// 响应接口
export interface Save_5Res {
    message: string;
    success: boolean;
    code: number;
    data: Record<string, unknown>;
}

/**
 * 保存或修改
 * @param {object} params 保存路由参数
 * @param {number} params.id 序号
 * @param {string} params.label 路由名称
 * @param {string} params.icon 图标
 * @param {string} params.route 路径
 * @param {string} params.component 组件
 * @param {number} params.state 状态
 * @returns
 */
export function save_5(params: Save_5Params): Promise<Save_5Res> {
    return request.post(`/menuEntity/save`, params);
}

// 参数接口
export interface Exist_5Params {
    id?: number;
}

// 响应接口
export interface Exist_5Res {
}

/**
 * 是否存在
 * @param {object} params IdParam
 * @param {number} params.id ID，记录唯一标识
 * @returns
 */
export function exist_5(params: Exist_5Params): Promise<Exist_5Res> {
    return request.post(`/menuEntity/exist`, params);
}


// 参数接口
export interface Detail_5Params {
    id?: number;
}

// 响应接口
export interface Detail_5Res {
    message: string;
    success: boolean;
    code: number;
    data: {
        id: number;
        label: string;
        icon: string;
        route: string;
        component: string;
        state: number;
        createTime: Record<string, unknown>;
        updateTime: Record<string, unknown>;
    };
}

/**
 * 根据id查找
 * @param {object} params IdParam
 * @param {number} params.id ID，记录唯一标识
 * @returns
 */
export function detail_5(params: Detail_5Params): Promise<Detail_5Res> {
    return request.post(`/menuEntity/detail`, params);
}

// 参数接口
export interface Delete_5Params {
    id?: number;
}

// 响应接口
export interface Delete_5Res {
    message: string;
    success: boolean;
    code: number;
    data: Record<string, unknown>;
}

/**
 * 根据id删除
 * @param {object} params IdParam
 * @param {number} params.id ID，记录唯一标识
 * @returns
 */
export function delete_5(params: Delete_5Params): Promise<Delete_5Res> {
    return request.post(`/menuEntity/delete`, params);
}

// 响应接口
export interface List_5Res {
    message: string;
    success: boolean;
    code: number;
    data: {
        id: number;
        label: string;
        icon: string;
        route: string;
        component: string;
        state: number;
        createTime: Record<string, unknown>;
        updateTime: Record<string, unknown>;
    }[];
}

/**
 * 路由列表
 * @returns
 */
export function list_5(): Promise<List_5Res> {
    return request.get(`/menuEntity/list`);
}

